/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package plash.display;

/**
 *
 * @author  #0K Srinivasan <hashok.com>
 */
public class GraphicOvalShape extends GraphicLinearPathShape
{
    private int _x;
    private int _y;
    private int _radiusX;
    private int _radiusY;
    
    public GraphicOvalShape(Graphics g, int x, int y, int radiusX, int radiusY)
    {
        super(g);
        _x = x;
        _y = y;
        _radiusX = radiusX;
        _radiusY = radiusY;
        
        __minPoint.setX(x - (radiusX / 2));
        __minPoint.setY(y - (radiusY / 2));
        
        __maxPoint.setX(x + (radiusX / 2));
        __maxPoint.setY(y + (radiusY / 2));
        
        __boundingBox.setX(__minPoint.getX());
        __boundingBox.setY(__minPoint.getY());
        
        __boundingBox.setWidth(__maxPoint.getX() - __minPoint.getY());
        __boundingBox.setHeight(__maxPoint.getY() - __minPoint.getY());
    }
    
    public GraphicOvalShape(Graphics g, int x, int y, int radius)
    {
        this(g, x, y, radius, radius);
    }

    @Override
    public void execute()
    {
        if(__g == null)
        {
            return;
        }
        if(__g.getOwner().getPainter() == null)
        {
            return;
        }        
        __g.getOwner().getPainter().ellipse(_x, _y, _radiusX, _radiusY);
    }
    
}
